/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package azhar.view.com;

import azhar.view.Main;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Al-Insan
 */
public class SignalStatus implements Runnable {

    private Main main;
    private Thread th = new Thread(this);
    private int y = 0;
    private int x = 0;

    /** Creates new form BatteryStatus */
    public SignalStatus(Main m) {
        main = m;
    }

    public void start() {
        th.start();
    }

    public void stop() {
        x=0;y=0;
        th.stop();
    }

    public void run() {
        while (true) {
            try {
                y = main.getBattery();
            } catch (Exception ex) {
                y=0;
            }
            try {
                x = main.getSignal();
            } catch (Exception ex) {
                x=0;
            }
                main.signal(x);
                main.battery(y);
            try {
                th.sleep(100);
            } catch (InterruptedException ex) {
                
            }
        }
    }
}
